home *** CD-ROM | disk | FTP | other *** search
/ Digital Image Library 3 / Digital Image Library - Volume 3 / Digital Image Library - Volume 3.bin / Data / mwcd_lib.js < prev    next >
Encoding:
Text File  |  2005-07-23  |  3.3 KB  |  97 lines

  1. // detect browser
  2. var browser = new Object();
  3.  
  4. browser.version = parseInt(navigator.appVersion);
  5.  
  6. browser.isNetscape = false; browser.isIE = false;
  7.  
  8. if (navigator.appName.indexOf('Netscape') != -1) {
  9.     browser.isNetscape = true;
  10. }
  11. else if (navigator.appName.indexOf('Microsoft') != -1) {
  12.     browser.isIE = true;
  13. }
  14.  
  15. // resize detect
  16. if(!window.saveInnerWidth) {
  17.   window.onresize = resizeMe;
  18.   window.saveInnerWidth = window.innerWidth;
  19.   window.saveInnerHeight = window.innerHeight;
  20. }
  21. // end resize detect
  22.  
  23. function newImage(arg) {
  24.     if (document.images) {
  25.         rslt = new Image();
  26.         rslt.src = arg;
  27.         return rslt;
  28.     }
  29. }
  30.  
  31. function changeImages() {
  32.     if (document.images && (preloadFlag == true)) {
  33.         for (var i=0; i<changeImages.arguments.length; i+=2) {
  34.             document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
  35.         }
  36.     }
  37. }
  38.  
  39. var preloadFlag = false;
  40. function preloadImages() {
  41. // alert("preloading basic");
  42.     if (document.images) {
  43.         butviewpdf_over = newImage('images/b/b_viewpdf_over.gif');
  44.         butviewpdf_down = newImage('images/b/b_viewpdf_down.gif');
  45.         butviewdetails_over = newImage('images/b/b_viewdetails_over.gif');
  46.         butviewdetails_down = newImage('images/b/b_viewdetails_down.gif');
  47.         butcontinue_over = newImage('images/b/b_continue_over.gif');
  48.         butcontinue_down = newImage('images/b/b_continue_down.gif');
  49.         help_over = newImage("images/n/images/help-over.gif");
  50.         about_over = newImage("images/n/images/about-over.gif");
  51.         main_over = newImage("images/n/images/main-over.gif");
  52.         logo_over = newImage("images/n/mwlogo_roll.gif");
  53.         nav_d1_contents_over = newImage("images/n/nav_d1_contents_over.gif");
  54.         nav_d1_contents_down = newImage("images/n/nav_d1_contents_down.gif");
  55.         artbitz_over = newImage("images/nb/images/artbitz-over.gif");
  56.         bigstockphoto_over = newImage("images/nb/images/bigstockphoto-over.gif");
  57.         imagescom_over = newImage("images/nb/images/imagescom-over.gif");
  58.         istockphoto_over = newImage("images/nb/images/istockphoto-over.gif");
  59.         shutterpoint_over = newImage("images/nb/images/shutterpoint-over.gif");
  60.         shutterstock_over = newImage("images/nb/images/shutterstock-over.gif");
  61.         readlicense_over = newImage("images/bmain/images/readlicense-over.jpg");
  62.         website_over = newImage("images/bmain/images/website-over.jpg");
  63.         viewgallery_over = newImage("images/bmain/images/viewgallery-over.jpg");
  64.         preloadFlag = true;
  65.     }
  66. }
  67.  
  68. function resizeMe() {
  69.     if (saveInnerWidth < window.innerWidth || saveInnerWidth > window.innerWidth || 
  70.         saveInnerHeight > window.innerHeight || saveInnerHeight < window.innerHeight ) 
  71.     {
  72.         window.history.go(0);
  73.     }
  74. }
  75.  
  76. function isNetscape() {
  77.     if (browser.isNetscape) {
  78.         return true;
  79.     } else {
  80.         return false;
  81.     }
  82. }
  83.  
  84. function moveFiletoDisk(thefile, thefilename) {
  85.     var win = window.open("", "win", "width=300,height=250"); // a window object
  86.     with (win.document) {
  87.         open("text/html", "replace");
  88.          write("<HTML><HEAD><TITLE>Install" + thefilename + "</TITLE><META HTTP-EQUIV='Refresh' CONTENT='2;URL=" + thefile + "'></HEAD><BODY><div align=center>");
  89.         write("<h1>" + thefilename + "</h1><br> <br>");
  90.         write("<br> <br> <br><font face='arial, helvetica, geneva' size=1 color='#333333'>Samples may take a few minutes to load <br>over slow internet connections.<br> <br>Requires QuickTime</font></div></body></html>");
  91.  
  92.         close();
  93.     }    
  94. }
  95.  
  96.  
  97.